# Contributor: Keith Maxwell <keith.maxwell@gmail.com>
# Maintainer: Keith Maxwell <keith.maxwell@gmail.com>
pkgname=ruby-unf_ext
_gemname=unf_ext
pkgver=0.0.7.6
pkgrel=5
pkgdesc="Unicode Normalization Form support library for CRuby"
url="https://github.com/knu/ruby-unf_ext/"
arch="all"
license="MIT"
makedepends="ruby-dev"
checkdepends="ruby-test-unit"
source="https://rubygems.org/gems/$_gemname-$pkgver.gem
	gemspec.patch
	test-helper.patch
	"

builddir="$srcdir/$_gemname-$pkgver"

unpack() {
	default_unpack

	cd "$srcdir"
	gem unpack "$_gemname-$pkgver.gem"
}

build() {
	cd "$builddir/ext/unf_ext"
	ruby extconf.rb
	make

	cd "$builddir"
	cp ext/unf_ext/unf_ext.so lib/unf_ext.so
	gem build ./unf_ext.gemspec
}

check() {
	ruby -Ilib:test:. test/test_unf_ext.rb
}

package() {
	local _gemdir
	_gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	gem install --local \
		--install-dir "$_gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		"$builddir/$_gemname-$pkgver.gem"
	cd "$_gemdir"
	rm -r cache
	rmdir build_info doc extensions
}

sha512sums="c6b6bc797015875b0a3422dc1e9656eae6c42d2263fd6e73ba41a1789ac1ffe927f81d5d9874973fd8d9bd9486494efa725b081e553954121588818d454db7f2  unf_ext-0.0.7.6.gem
4a8ce282f732d3236d63494bac20d0a566b74b6d20b5ecc3df08a960cded2f72978795cb05c3fea6269867faf8b371b38d84a2228981d0b139a77566413eaa6b  gemspec.patch
fe494139d2d0d4fe183ac2079db90dfffab04736568a8d24e484f6ce0e71326a955e936d516a9f10362dc53706c6a98c408b4afce46fea4325b127f371a6d0c5  test-helper.patch"
